			$(document).ready(function() {
					if(sessionStorage["rules"]){
						var rules=JSON.parse(sessionStorage["rules"]);
					    var parentMenu=new Array();
					    //添加一级菜单
					    for(var i=0;i<rules.length;i++){
					    	if(rules[i].pid==0){
					    		parentMenu.push(rules[i]);
					    	}
					    }
					    //添加一级菜单的子菜单
					    for(var i=0;i<rules.length;i++){
					    	if(rules[i].pid!=0){
					    		for(var m=0;m<parentMenu.length;m++){
					    			if(rules[i].pid==parentMenu[m].id){
					    				if(!parentMenu[m]['child']){
					    			parentMenu[m]['child']=new Array();
					    		}
					    				parentMenu[m]['child'].push(rules[i]);
					    			}
					    		}
					    	}
					    }
					    //加载dom
					    var $ul=$(".sidebar-menu");
					    for(var i=0;i<parentMenu.length;i++){
					    	var $li=$('<li></li>');
					    	$li.addClass('treeview');
					    	$li.append("<a href='/"+parentMenu[i].name+"'><i class='fa fa-dashboard'></i>"+parentMenu[i].title+"<span class='pull-right-container'><i class='fa fa-angle-left pull-right'></i></span></a>")
					        $ul.append($li);
					        var $liChild;
					        if(parentMenu[i].child.length>0){
					        	$liChild=$('<ul></ul>');
					        	$liChild.addClass("treeview-menu");
					        	$liChild.css("display","none");
					        	$li.append($liChild);
					        }
					        for(var c=0;c<parentMenu[i].child.length;c++){
					        	var $childli=$("<li></li>");
					    	    $childli.append("<a href='/"+parentMenu[i].child[c].name+"'><i class='fa fa-circle-o'></i>"+parentMenu[i].child[c].title+"</a>")
					        	$liChild.append($childli);
					        }
					    }
					    console.log($ul);
					}else{
						location.href="/";
					}
				});